import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

public class UdpDictServer extends UdpEchoServer{
    private HashMap<String,String> dict = new HashMap<>();

    public UdpDictServer(int port) throws SocketException {
        super(port);
        dict.put("苹果","apple");
        dict.put("电脑","Computer");
        dict.put("跑步","run");
        dict.put("快速的","quickly");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"未找到该单词！");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer udpDictServer = new UdpDictServer(9090);
        udpDictServer.start();
    }

}
